<template>
  <div>
    <h2>row (默认)</h2>
    <div class="flex-container row">
      <div class="flex-item">1</div>
      <div class="flex-item">2</div>
      <div class="flex-item">3</div>
      <div class="flex-item">4</div>
    </div>

    <h2>row-reverse</h2>
    <div class="flex-container row-reverse">
      <div class="flex-item">1</div>
      <div class="flex-item">2</div>
      <div class="flex-item">3</div>
      <div class="flex-item">4</div>
    </div>

    <h2>column</h2>
    <div class="flex-container column">
      <div class="flex-item">1</div>
      <div class="flex-item">2</div>
      <div class="flex-item">3</div>
      <div class="flex-item">4</div>
    </div>

    <h2>column-reverse</h2>
    <div class="flex-container column-reverse">
      <div class="flex-item">1</div>
      <div class="flex-item">2</div>
      <div class="flex-item">3</div>
      <div class="flex-item">4</div>
    </div>

  </div>
</template>

<script>
export default {
  name: ""
}
</script>

<style lang="less" scoped>
.flex-container {
  margin: 5px;
  display: flex;
  flex-wrap: wrap;
  /* 允许项目换行 */
  width: 300px;
  height: 200px;
  border: 1px solid #000;
  padding: 10px;
  box-sizing: border-box;
}

.flex-item {
  width: 50px;
  height: 50px;
  margin: 5px;
  background-color: lightblue;
  text-align: center;
  line-height: 50px;
  color: #333;
}

/* 使用不同的 flex-direction 值来改变项目的排列方向 */

/* flex-direction: row (默认值) */
.flex-container.row {
  flex-direction: row;
}

/* flex-direction: row-reverse */
.flex-container.row-reverse {
  flex-direction: row-reverse;
}

/* flex-direction: column */
.flex-container.column {
  flex-direction: column;
}

/* flex-direction: column-reverse */
.flex-container.column-reverse {
  flex-direction: column-reverse;
}
</style>
